home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir31 / pas16reg.zip / PAS16REG.TXT
Text File  |  1993-10-09  |  14KB  |  394 lines

  1. Pro Audio Spectrum 16 PCM Hardware Register Functions
  2. Brought to you by "Code Blue" from IRC's #coders channel.
  3. Version 1.0 -- "Code Blue" -- Oct. 7, 1993
  4.  
  5. This textfile is a reference to the PAS-16's PCM hardware register functions.
  6. Both the high and low-level function call interfaces are built upon this
  7. interface.  PCM hardware register functions provide you with ultimate control
  8. over PCM programming.
  9.  
  10. The PAS-16's PCM circuitry, aided by DMA, samples and plays back PCM
  11. waveforms.  With DMA, the PAS-16 sends or receives data samples without
  12. direct program involvement.  You must ensure that the DMA is set up with
  13. a dedicated memory area to process DMA transfers.  Using double-buffering
  14. techniques, you can create continuous sound waveforms by simply filling one
  15. buffer area while the other is being played. 
  16.  
  17. * Audio Filter Control * Register B8Ah
  18. Use the Audio Filter Control Register to set bit masks that enable and
  19. disable counters and allow the system to generate interrupts, mute and
  20. reset the board; and, select filtering for PCM playback.
  21.  
  22. D7 = Sample Buffer Counter Gate
  23. D6 = Sample Rate Timer Gate
  24. D5 = Audio Mute
  25. D4 = Filter Select Bit 4
  26. D3 = Filter Select Bit 3
  27. D2 = Filter Select Bit 2
  28. D1 = Filter Select Bit 1
  29. D0 = Filter Select Bit 0
  30.  
  31. Sample Buffer Counter Gate (D7)
  32. Use this bit to enable the Sample Buffer Count register.  More info on this
  33. follows later in this text file (Sample Buffer Count Register 1389h).
  34.  
  35.         [ D7 ]  [ Description ]
  36. Settings: 1     Enable Sample Buffer Counter.
  37.           0     Disable Sample Buffer Counter.
  38. Default:  0
  39.  
  40. Sample Rate Timer Gate (D6)
  41. Use this bit to enable the Sample Rate Timer Register.  More info on this
  42. follows later in this text file (Sample Rate Timer Register 1388h).
  43.  
  44.         [ D6 ]  [ Description ]
  45. Settings: 1     Enable Sample Rate Timer
  46.           0     Disable Sample Rate Timer
  47. Default:  0
  48.  
  49. Audio Mute (D5)
  50. Use this bit to enable and disable the PAS-16 audio output.  When the PAS-16
  51. is enabled, all audio sources (including PC speaker) can be mixed and output
  52. to speakers or headphones.
  53. When the PAS-16 is disabled, only the PC speaker can output sound.
  54.  
  55.         [ D5 ]  [ Description ]
  56. Settings: 1     Enable PAS-16
  57.           0     Disable PAS-16
  58. Default:  0
  59.  
  60. Filter Select (D4 through D0)
  61. Use these bits to select a filter to eliminate unwanted high-frequency
  62. harmonics.  For proper filtering and playback, select a filter with a
  63. limiting frequency equal to half the sample rate.  If more than one audio
  64. signal source is combined in the input mixer, a lower quality audio signal
  65. should dictate the filter selection.  All filter settings below have a
  66. low-end threshold of 20Hz.
  67.  
  68.         [ D4 ] [ D3 ] [ D2 ] [ D1 ] [ D0 ] [ Description ]
  69. Settings: 0      0      0      0      1    Select filter rate of 17.897 kHz     
  70.           0      0      0      1      0    Select filter rate of 15.909 kHz
  71.           0      1      0      0      1    Select filter rate of 11.931 kHz
  72.           1      0      0      0      1    Select filter rate of 8.948 kHz
  73.           1      1      0      0      1    Select filter rate of 5.965 kHz
  74.           0      0      1      0      0    Select filter rate of 2.982 kHz
  75. Default:  0      0      0      0      0    No filter
  76.  
  77. * PCM Data * Register F88h
  78. Use the PCM Data register to read samples from the A/D Converter (ADC) and
  79. write data to the D/A Converter (DAC).  All 8 bits of this register are
  80. programmed as a group.
  81.  
  82. Use the PCM Data Register only for direct mode transfers, not for non-DMA
  83. PCM.
  84.  
  85. D7 = PCM Data Bit 7
  86. D6 = PCM Data Bit 6
  87. D5 = PCM Data Bit 5
  88. D4 = PCM Data Bit 4
  89. D3 = PCM Data Bit 3
  90. D2 = PCM Data Bit 2
  91. D1 = PCM Data Bit 1
  92. D0 = PCM Data Bit 0
  93.  
  94. * Cross Channel Control * Register F8Ah
  95. Use Cross Chanel Control register to manage the PCM hardware and DMA
  96. interface; and to configure the channel connections between mixers.  When
  97. the PAS-16 is reset, all bits in this register are cleared (set to 0).
  98.  
  99. D7 = DMA Enable
  100. D6 = PCM Enable
  101. D5 = Mono/Stereo Mode
  102. D4 = DAC/ADC Mode
  103. D3 = Left to Left
  104. D2 = Right to Left
  105. D1 = Left to Right
  106. D0 = Right to Right
  107.  
  108. DMA Enable (D7)
  109. USe this bit to turn DMA on between the PAS-16 DMA circuitry and the PC's
  110. motherboard.  When D7 is set to 1, DMA can occur.  When D7 is set to 0,
  111. the PAS-16's DMA circuitry is logically removed from the PC bus and other
  112. boards can use a shared DMA channel without conflict.  You should set this
  113. bit only when using PCM I/O.
  114.  
  115. You must set DMA Enable to 1 before programming the PC's DMA controller.
  116.  
  117.         [ D7 ]  [ Description ]
  118. Settings: 1     Enable PAS-16 DMA
  119.           0     Disable PAS-16 DMA
  120. Default:  0
  121.  
  122. PCM Enable (D6)
  123. Use this bit to enable the PCM state machine.
  124.  
  125. You must initialize the sample timer before enabling the PCM state machine.
  126. To enable the sample timer, see "Local Timer Control Register 138Bh" found
  127. later in this text file.
  128.  
  129.         [ D6 ]  [ Description ]
  130. Settings: 1     Enable PCM state machine.
  131.           0     Disable PCM state machine.
  132. Default:  0
  133.  
  134. Mono/Stereo Mode (D5)
  135. Use this bit to set the PCM circuitry to either mono or stereo mode.
  136.  
  137. In stereo mode, the first byte is left channel data and the second byte is
  138. right channel data.  You can determine whether the next byte is from the
  139. left or right channel by reading the interrupt status register at address
  140. B89h.
  141.  
  142.         [ D5 ]  [ Description ]
  143. Settings: 1     Set PCM to stereo mode
  144.           0     Set PCM to mono mode
  145. Default:  0
  146.  
  147. DAC/ADC Mode (D4)
  148. Use this bit to set the PCM circuitry to either output (DAC) or input (ADC)
  149. mode.
  150.  
  151.         [ D4 ]  [ Description ]
  152. Settings: 1     Enable output (DAC) mode.
  153.           0     Enable input (ADC) mode.
  154. Default:  0
  155.  
  156. Left to Left (D3)
  157. Use this bit to connect the left output channel of the Input Mixer to the
  158. left input channel of the Output Mixer.
  159.  
  160.         [ D3 ]  [ Description ]
  161. Settings: 1     Connect left output to left input
  162.           0     Disabled.
  163. Default:  0
  164.  
  165. Right to Left (D2)
  166. Use this bit to connect the right output channel of the Input Mixer to the
  167. left input channel of the Output Mixer.
  168.  
  169.         [ D2 ]  [ Description ]
  170. Settings: 1     Connect right output to left input
  171.           0     Disabled.
  172. Default:  0
  173.  
  174. Left to Right (D1)
  175. Use this bit to connect the left output channel of the Input Mixer to the
  176. right input channel of the Output Mixer.
  177.  
  178.         [ D1 ]  [ Description ]
  179. Settings: 1     Connect left output to right input
  180.           0     Disabled.
  181. Default:  0
  182.  
  183. Right to Right (D0)
  184. Use this bit to connect the right output channel of the Input Mixer to the
  185. right input channel of the Output Mixer.
  186.  
  187.         [ D0 ]  [ Description ]
  188. Settings: 1     Connect right output to right input
  189.           0     Disabled.
  190. Default:  0
  191.  
  192. * Sample Rate Timer * Register 1388h
  193. Use the Sample Rate Timer to set the interval for processing PCM samples.
  194. The PAS-16 processes a sample and then waits a specific period of time
  195. before processing the next one.  You use the Sample Rate Timer Register to
  196. specify this period of time.
  197.  
  198. Program all 16 bits of this register by writing a value representing the
  199. interval between samples.  To determine the proper programming sequence,
  200. see "Local Timer Control Register 138Bh", found later in this text file.
  201.  
  202. For stereo sampling, load the timer with an interval value half that of the
  203. mono sample rate, since twice the number of samples are required per sound.
  204.  
  205. Calculate interval values as follows:
  206.  Interval = 1,193,180 / sample rate
  207. For example, a 22kHz sample rate would calculate as follows:
  208.  Interval = 1,193,180 / 22,050 = 54
  209.  
  210. Note: Before setting the sample rate interval, be sure to select the Sample
  211.       Rate Timer using Local Timer Control Register 138Bh.  Also remember
  212.       to set the Sample Rate Timer Gate of the Audio Filter Control Register
  213.       B8Ah to 0 before programming the timer.
  214.  
  215. D7 = Interval Bit 7
  216. D6 = Interval Bit 6
  217. .
  218. .
  219. .
  220. D0 = Interval Bit 0
  221.  
  222. * Sample Buffer Count * Register 1389h
  223. Use the Sample Buffer Count register to set number of bytes in the DMA buffer
  224. division.  This register holds a 16-bit value.  When using a 16-bit DMA
  225. channel, the Sample Buffer Count must be divided by two.  For example, to
  226. set up a 2K DMA buffer division, you must program a count of 1K into the
  227. counter.  Once the counter decrements to zero, a Sample Buffer Counter
  228. Interrupt is generated and enabled.
  229.  
  230. D7 = Counter Bit 7
  231. D6 = Counter Bit 6
  232. .
  233. .
  234. .
  235. D0 = Counter Bit 0
  236.  
  237. Note: To determine the proper programming sequence for this register, see
  238.       "Local Time Control Register 138Bh", found later in this text file.
  239.       The Sample Buffer Counter Gate in the filter register (B8Ah) must
  240.       be set to zero before programming the counter.
  241.  
  242. * Local Time Control * Register 138Bh
  243. Use the Local Timer Control Register to enable and disable timers; set
  244. read and write modes; set timer generator modes; and select binary or BCD
  245. counting modes.
  246.  
  247. D7 = Timer Select Bit 1
  248. D6 = Timer Select Bit 0
  249. D5 = Read/Write Bit 1
  250. D4 = Read/Write Bit 0
  251. D3 = Timer Mode Bit 2
  252. D2 = Timer Mode Bit 1
  253. D1 = Timer Mode Bit 0
  254. D0 = Binary/BCD
  255.  
  256. Timer Select (D7 and D6)
  257. Use these two bits to select the Sample Rate Counter, Sample Buffer Counter,
  258. or the Local Speaker Timer Counter.  You must enable these functions before
  259. programming other PCM registers.
  260.  
  261.         [ D7 ] [ D6 ] [ Description ]
  262. Settings: 0      0    Select Sample Rate Timer.
  263.           0      1    Select Sample Buffer Counter.
  264.           1      0    Select Local Speaker Timer Counter
  265. Default: N/A    N/A
  266.  
  267. Read/Write (D5 and D4)
  268. Use these two bits to enable the 16-bit sample timer.  In 16-bit mode, read
  269. or write the least significant byte first, then the most significant byte.
  270.  
  271.         [ D5 ] [ D4 ] [ Description ]
  272. Settings: 1      1    Enable 16-bit timer.
  273. Default:  0      0
  274.  
  275. Timer Mode (D3 through D1)
  276. Use these three bits to select a timer mode.  Timer Mode must be matched to
  277. the timer you have enabled:
  278.  
  279. (*) For Sample Rate Timer, set Timer Mode to >> Square Wave Generator <<
  280.  
  281. (*) For Sample Buffer Count, set Timer Mode to >> Rate Generator <<
  282.  
  283.         [ D3 ] [ D2 ] [ D1 ] [ Description ]
  284. Settings: 0      1      0    Select Rate Generator (Sample Rate Timer)
  285.           0      1      1    Select Square Wave Generator (Sample Buffer Cnt)
  286. Default:  0             0
  287.  
  288. Binary/BCD (D0)
  289. Use this bit to set the timer counting mode to binary or BCD.  This bit
  290. should normally be set to binary mode.
  291.  
  292.         [ D0 ] [ Description ]
  293. Settings: 0    Set counting mode to binary.
  294.           1    Set counting mode to BCD.
  295. Default:  0
  296.  
  297. * Sample Size Configuration * Register 8389h
  298. Use the Sample Size Configuration Register to select output sample
  299. compression ratios and 8 or 16-bit audio.
  300.  
  301. D7,D6,D5,D4,D3 = Reserved
  302. D2 = 8/16-bit Audio
  303. D1 = Over Sampling Bit 1
  304. D0 = Over Sampling Bit 0
  305.  
  306. Reserved (D7 through D3)
  307. These bits should not be programmed by application developers.  Modifying
  308. any of these bits will result in unpredictable behavior by the PAS-16.
  309.  
  310. 8/16-bit Audio (D2)
  311. Use this bit to select either 8 or 16-bit audio.  Choosing 16-bit audio
  312. results in better sound quality (no shit).
  313.  
  314.         [ D2 ] [ Description ]
  315. Settings: 0    Set audio byte size to 8-bit
  316.           1    Set audio byte size to 16-bit
  317. Default:  0
  318.  
  319. Over Sampling (D1 and D0)
  320. Use these bits to select over-sampling rates of 1,2, or 4 times.
  321.         [ D1 ] [ D0 ] [ Description ]
  322. Settings: 0      0    Set over sampling rate to 1X
  323.           0      1    Set over sampling rate to 2X
  324.           1      1    Set over sampling rate to 4X
  325. Default:  0      0
  326.  
  327. ----------------------------------------------------------------------------
  328. INT 2F Function Calls
  329. The INT 2F multiplex interrupt is used by applications to talk directly to
  330. the control devices on the PAS-16 like the mixers and volume control.
  331. INT 2F calls are made directly to the MVSOUND.SYS device driver rather than
  332. through MS-DOS.  This interface is non-reentrant and uses a semaphore to
  333. control entry.  Return values indicate whether calls were successful or
  334. whether a collision occured with another process.
  335.  
  336. Common function call method
  337. All functions share a common method for function call entry and exit.  They
  338. are called through a single entry point using appropriate function numbers
  339. in register AX and function number variables in register BX, CX, and DX.
  340.  
  341. Return values are placed in registers AX, BX, CX, and DX.  The normal return
  342. values are listed below:
  343.  
  344. Register        Normal Return Value
  345. AX              'MV' if the call was successful
  346.                 not 'MV' if the call failed
  347. BX,CX,DX        Varies by function call
  348.  
  349. Example below shows the common calling method.  Prototype function call
  350. entry/exit code can be found on the developer's kit disk in the
  351. MIXERS.H file.
  352.         ASM     include binary.inc
  353.         AH      0xBC            ;Mediavision INT2F identifier
  354.         AX      function        ;Mediavision function number (0xBChh)
  355.         BX                      (call dependent)
  356.         CX                      (call dependent)
  357.         DX                      (call dependent)
  358.  
  359. Check for Driver * Function 0        
  360. Checks to see if the MVSOUND.SYS device driver is loaded.  If the device
  361. driver is loaded, the function returns a unique set of values in variables
  362. AX and BX.
  363.  
  364. Input parameters
  365. AX      0xBC00
  366. BX      0x3F3F
  367.  
  368. Return values
  369. If the driver is loaded:
  370. AX      0xBC00  (unchanged)
  371. BX      0x6D00  (M)
  372. CX      0x0076  (V)
  373. DX      0x2020
  374. XORING CX and DX into BX returns the ASCII characters "MV".  If the driver
  375. isn't loaded, values in the registers are unknown.
  376.  
  377. Get DMA/IRQ/INT * Function 4
  378. Returns the DMA, IRQ, and INT numbers that were selected when the MVSOUND.SYS
  379. driver was loaded.  These numbers are specified in the Device command line
  380. in CONFIG.SYS
  381.  
  382. Input Parameters
  383. AX      0xBC04
  384.  
  385. Return Values
  386. If successful:
  387. AX      'MV'
  388. BX      DMA Channel number (1-3,5-7)
  389. CX      IRQ Channel number (3-15)
  390. DX      INT number (unused)
  391. If failed:
  392. AX      doesn't contain 'MV'
  393. BX,CX,DX undefined
  394.